package designparttern.singleton;

class Lazy {
    private static Lazy INSTANCE = null;

    private Lazy() {
    }

    private static synchronized Lazy getInstance() {
        //  这里可能出现线程不安全的情况,所以需要加锁
        if (INSTANCE == null) {
            INSTANCE = new Lazy();
        }
        return INSTANCE;
    }
}